﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media.Imaging;

namespace CanTIceCream
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public static bool IsMake = true;
        public Thread thread = null;
        public Thread Icethr = null;
        public List<string> icelist = new List<string>();
        public static string IPorPortUrl = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"\IPorPortMessage.txt";
        public MainWindow()
        {
            InitializeComponent();
        }
        public void MakingShowNo(string code)
        {
            try
            {
                IceMsg.Instance.ClientSend(code);
                Thread.Sleep(2000);
                while (IceModel.Instance.IsGZZT != "01")
                {
                    Thread.Sleep(1000);
                }
                icelist.RemoveAt(0);
            }
            catch (Exception)
            {
                return;
            }
        }
        public static string EmailError(int bql, int wwl)
        {
            try
            {
                string msg = "<style>table{ border: 1px solid black; border-collapse: collapse; }table td{border: 1px solid #000000; padding: 5px 15px;font-size:14px;}</style><table>";
                if (bql == 1)
                    msg += "<tr><td style='font-weight:bold;'>冰淇淋</td><td>adequate materials</td></tr>";
                else
                    msg += "<tr><td style='font-weight:bold;'>冰淇淋</td><td style='color:#FF0000;'>Lack of material</td></tr>";
                if (wwl == 1)
                    msg += "<tr><td style='font-weight:bold;'>杯子</td><td>adequate materials</td></tr>";
                else
                    msg += "<tr><td style='font-weight:bold;'>杯子</td><td style='color:#FF0000;'>Lack of material</td></tr>";

                msg += "</table>";
                return msg;
            }
            catch (Exception)
            {
                return "";
            }
        }
        /// <summary>
        /// 制作咖啡机
        /// </summary>
        /// <param name="list"></param>
        public void MakingShow(DeviceOrderQueue list, string orderNum)
        {
            try
            {
                if (IceModel.Instance.IsGZZT != "01") return;
                IsMake = false;
                string sauceCode = "";
                string nutletCode = "";
                var msgs = JsonConvert.DeserializeObject<List<specification>>(list.jsonCodeVal);
                if (msgs != null)
                {
                    sauceCode = msgs.Any(a => a.sauceCode == "1") ? "01 00" : msgs.Any(a => a.sauceCode == "2") ? "01 00" : msgs.Any(a => a.sauceCode == "3") ? "03 00" : msgs.Any(a => a.sauceCode == "4") ? "04 00" : msgs.Any(a => a.sauceCode == "5") ? "05 00" : msgs.Any(a => a.sauceCode == "6") ? "06 00" : msgs.Any(a => a.sauceCode == "7") ? "07 00" : "00 00";
                    nutletCode = msgs.Any(a => a.nutletCode == "1") ? "01 00" : msgs.Any(a => a.nutletCode == "2") ? "02 00" : msgs.Any(a => a.nutletCode == "3") ? "03 00" : msgs.Any(a => a.nutletCode == "4") ? "04 00" : msgs.Any(a => a.nutletCode == "5") ? "05 00" : msgs.Any(a => a.nutletCode == "6") ? "06 00" : msgs.Any(a => a.nutletCode == "7") ? "07 00" : "00 00";
                }
                string making = IceMake.Instance.Making + " " + sauceCode + " " + nutletCode;
                EditDeviceOrderStatus status = new EditDeviceOrderStatus();
                status.orderGoodsId = list.id;
                status.orderId = list.orderId;
                status.status = "4";
                string lists = JsonConvert.SerializeObject(status);
                HttpMsg.Instance.editDeviceOrderStatusMsg(lists);
                Thread.Sleep(1000);
                IceMsg.Instance.ClientSend(making);
                Thread.Sleep(7000);
                if (IceModel.Instance.IsGZZT == "01")
                {
                    Thread.Sleep(1000);
                    IceMsg.Instance.ClientSend(making);
                }
                Thread.Sleep(7000);
                while (IceModel.Instance.IsGZZT != "01")
                {
                    Thread.Sleep(1000);
                }
                Thread.Sleep(15000);
                EditDeviceOrderStatus status2 = new EditDeviceOrderStatus();
                status2.orderGoodsId = list.id;
                status2.orderId = list.orderId;
                status2.status = "5";
                string lists2 = JsonConvert.SerializeObject(status2);
                HttpMsg.Instance.editDeviceOrderStatusMsg(lists2);
                IsMake = true;
            }
            catch (Exception)
            {
                IsMake = true;
                return;
            }
        }
        /// <summary>
        /// 全部订单查询
        /// </summary>
        public void MsgShow()
        {
            while (true)
            {
                try
                {
                    Device device = new Device();
                    string lists = JsonConvert.SerializeObject(device);
                    var data = HttpMsg.Instance.deviceOrderQueueListMsg(lists);
                    Console.WriteLine(data);
                    if (data != null)
                    {
                        var msglist = JsonConvert.DeserializeObject<HTTPMsg>(data);
                        if (msglist != null)
                        {
                            if (msglist.data.ToString().Length > 10)
                            {
                                var list = JsonConvert.DeserializeObject<List<deviceOrderQueueList>>(msglist.data.ToString());
                                if (list.Count > 0)
                                {
                                    if (list.Count > 0)
                                    {
                                        if (IsMake)
                                        {
                                            if (list[0].typeList3.Count > 0)
                                            {
                                                var make = list[0].typeList3.FirstOrDefault(a => a.status == "3" || a.status == "4");
                                                if (make != null)
                                                {
                                                    if (IceMsg.Instance.clientsockets != null)
                                                        MakingShow(make, list[0].orderNum);
                                                }
                                            }
                                        }

                                    }
                                }
                            }
                            else
                            {
                                if (icelist.Count > 0)
                                {
                                    if (IceMsg.Instance.clientsockets != null)
                                        MakingShowNo(icelist[0]);
                                }
                            }
                        }
                        else
                        {
                            if (icelist.Count > 0)
                            {
                                if (IceMsg.Instance.clientsockets != null)
                                    MakingShowNo(icelist[0]);
                            }
                        }
                    }
                    else
                    {
                        if (icelist.Count > 0)
                        {
                            if (IceMsg.Instance.clientsockets != null)
                                MakingShowNo(icelist[0]);
                        }
                    }
                    Thread.Sleep(2000);
                }
                catch (Exception)
                {
                    Thread.Sleep(1000);
                }
            }
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                // 绑定视频文件
                myMediaElement.Source = new Uri(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "video.mp4");
                // 交互式控制
                myMediaElement.LoadedBehavior = MediaState.Manual;
                // 添加元素加载完成事件 -- 自动开始播放
                myMediaElement.Loaded += new RoutedEventHandler(media_Loaded);
                // 添加媒体播放结束事件 -- 重新播放
                myMediaElement.MediaEnded += new RoutedEventHandler(media_MediaEnded);
                // 添加元素卸载完成事件 -- 停止播放
                myMediaElement.Unloaded += new RoutedEventHandler(media_Unloaded);
                if (!File.Exists(IPorPortUrl))
                {
                    using (FileStream stream = File.Create(IPorPortUrl))
                    {
                        stream.Close();
                        stream.Dispose();
                        IPorPortInfo porPortInfo1 = IPorPortInfo.Instance;
                        File.WriteAllText(IPorPortUrl, JsonConvert.SerializeObject(porPortInfo1));
                    }
                }
                else
                {
                    var porPortInfo = JsonConvert.DeserializeObject<IPorPortInfo>(File.ReadAllText(IPorPortUrl));
                    IPorPortInfo.Instance.CoffeeIP = porPortInfo.CoffeeIP;
                    IPorPortInfo.Instance.CoffeePort = porPortInfo.CoffeePort;
                    IPorPortInfo.Instance.RobotIPLeft = porPortInfo.RobotIPLeft;
                    IPorPortInfo.Instance.EWMPortName = porPortInfo.EWMPortName;
                    IPorPortInfo.Instance.SMPortName = porPortInfo.SMPortName;
                    IPorPortInfo.Instance.IOPortName = porPortInfo.IOPortName;
                    IPorPortInfo.Instance.SweetInit1 = porPortInfo.SweetInit1;
                    IPorPortInfo.Instance.SweetInit2 = porPortInfo.SweetInit2;
                    IPorPortInfo.Instance.SweetInit3 = porPortInfo.SweetInit3;
                }
                if (!Directory.Exists(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"报警"))
                {
                    Directory.CreateDirectory(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"报警");
                }
                saveDeviceMatter save = new saveDeviceMatter();
                save.matterStatusJson = JsonConvert.SerializeObject(iceMetters.Instance);
                save.deviceStatusJson = JsonConvert.SerializeObject(deviceStatus.Instance);
                var saves = JsonConvert.SerializeObject(save);
                var dd = HttpMsg.Instance.saveDeviceMatterMsg(saves);
                Icethr = new Thread(IceMsg.Instance.CoffeeMake);
                Icethr.IsBackground = true;
                Icethr.Start();
                thread = new Thread(MsgShow);
                thread.IsBackground = true;
                thread.Start();
                Thread ewm = new Thread(EWMMsg.Instance.IOSerial_Thr);
                ewm.IsBackground = true;
                ewm.Start();
                Thread thread1 = new Thread(timerShow);
                thread1.IsBackground = true;
                thread1.Start();
            }
            catch (Exception)
            {
                return;
            }
        }
        public static bool isTime = true;
        public void timerShow()
        {
            try
            {
                while (true)
                {
                    try
                    {

                        int hour = DateTime.Now.Hour;
                        int minute = DateTime.Now.Minute;
                        if (hour == 22 && minute == 00)
                        {
                            if (isTime)
                            {
                                Thread.Sleep(100);
                                IceMsg.Instance.ClientSend(" AA 00 20 00 00 00 08 00 07 00 00 00 00 00 00 00");
                                isTime = false;
                            }
                        }
                        else if (hour == 22 && minute == 01)
                        {
                            isTime = true;
                        }
                        else if (hour == 6 && minute == 00)
                        {
                            if (isTime)
                            {
                                Thread.Sleep(100);
                                IceMsg.Instance.ClientSend(" AA 00 20 00 00 00 08 00 06 00 00 00 00 00 00 00");
                                isTime = false;
                            }
                        }
                        else if (hour == 6 && minute == 01)
                        {
                            isTime = true;
                        }
                    }
                    catch (Exception)
                    {
                    }
                    Thread.Sleep(30000);
                }

            }
            catch (Exception)
            {
                return;
            }
        }
        private void media_Loaded(object sender, RoutedEventArgs e)
        {
            ((MediaElement)sender).Play();
            ((MediaElement)sender).Volume = 0f;
        }
        private void media_MediaEnded(object sender, RoutedEventArgs e)
        {
            // MediaElement需要先停止播放才能再开始播放，
            // 否则会停在最后一帧不动
            ((MediaElement)sender).Stop();
            ((MediaElement)sender).Play();
        }
        private void media_Unloaded(object sender, RoutedEventArgs e)
        {
            ((MediaElement)sender).Stop();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string gj = boluo.Tag.ToString() == "0" && caomei.Tag.ToString() == "0" && lanmei.Tag.ToString() == "0" ? " 00 00" : boluo.Tag.ToString() == "1" && caomei.Tag.ToString() == "0" && lanmei.Tag.ToString() == "0" ? " 01 00" : boluo.Tag.ToString() == "0" && caomei.Tag.ToString() == "1" && lanmei.Tag.ToString() == "0" ? " 01 00" : boluo.Tag.ToString() == "0" && caomei.Tag.ToString() == "0" && lanmei.Tag.ToString() == "1" ? " 03 00" : boluo.Tag.ToString() == "1" && caomei.Tag.ToString() == "1" && lanmei.Tag.ToString() == "0" ? " 04 00" : boluo.Tag.ToString() == "1" && caomei.Tag.ToString() == "0" && lanmei.Tag.ToString() == "1" ? " 05 00" : boluo.Tag.ToString() == "0" && caomei.Tag.ToString() == "1" && lanmei.Tag.ToString() == "1" ? " 06 00" : boluo.Tag.ToString() == "1" && caomei.Tag.ToString() == "1" && lanmei.Tag.ToString() == "1" ? " 07 00" : " 00 00";
                string gs = huasheng.Tag.ToString() == "0" && guosui.Tag.ToString() == "0" ? " 00 00" : huasheng.Tag.ToString() == "1" && guosui.Tag.ToString() == "0" ? " 01 00" : huasheng.Tag.ToString() == "0" && guosui.Tag.ToString() == "1" ? " 02 00" : huasheng.Tag.ToString() == "1" && guosui.Tag.ToString() == "1" ? " 04 00" : " 00 00";
                icelist.Add(IceMake.Instance.Making + gj + gs);
                //MessageBox.Show(gj + gs);
            }
            catch (Exception)
            {
                return;
            }
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                // icelist.Add("AA 00 20 00 00 00 04 00 01 00 00 00");
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 04 00 01 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            try
            {
                //IceMsg.Instance.ClientSend("AA 00 20 00 00 00 04 00 09 00 00 00");
                Thread.Sleep(100);
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 07 00 00 00 00 00 00 00");
                //  icelist.Add("AA 00 20 00 00 00 04 00 07 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 06 00 00 00 00 00 00 00");
                //icelist.Add("AA 00 20 00 00 00 04 00 06 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void exit_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            try
            {
                if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2)
                {
                    MessageBoxResult result = MessageBox.Show("Exit orders will not be made,Do you really want to quit?", "Exit", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
                    if (result == MessageBoxResult.Yes)
                    {
                        //this.Dispatcher.BeginInvoke(new Action(delegate
                        //{
                        this.Close();
                        System.Windows.Application.Current.Shutdown();
                        System.Diagnostics.Process.GetCurrentProcess().Kill();
                        //}));
                    }
                }
            }
            catch (Exception)
            {
                return;
            }
        }

        private void boluo_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (boluo.Tag.ToString() == "0")
                {
                    boluo.Tag = "1";
                    boluo.BorderThickness = new Thickness(5);
                }
                else
                {
                    boluo.Tag = "0";
                    boluo.BorderThickness = new Thickness(0);
                }
            }
            catch (Exception)
            {
                return;
            }
        }

        private void caomei_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (caomei.Tag.ToString() == "0")
                {
                    caomei.Tag = "1";
                    caomei.BorderThickness = new Thickness(5);
                }
                else
                {
                    caomei.Tag = "0";
                    caomei.BorderThickness = new Thickness(0);
                }
            }
            catch (Exception)
            {

                return;
            }
        }

        private void lanmei_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (lanmei.Tag.ToString() == "0")
                {
                    lanmei.Tag = "1";
                    lanmei.BorderThickness = new Thickness(5);
                }
                else
                {
                    lanmei.Tag = "0";
                    lanmei.BorderThickness = new Thickness(0);
                }
            }
            catch (Exception)
            {

                return;
            }
        }

        private void huasheng_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (huasheng.Tag.ToString() == "0")
                {
                    huasheng.Tag = "1";
                    huasheng.BorderThickness = new Thickness(5);
                }
                else
                {
                    huasheng.Tag = "0";
                    huasheng.BorderThickness = new Thickness(0);
                }
            }
            catch (Exception)
            {

                return;
            }
        }

        private void guosui_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (guosui.Tag.ToString() == "0")
                {
                    guosui.Tag = "1";
                    guosui.BorderThickness = new Thickness(5);
                }
                else
                {
                    guosui.Tag = "0";
                    guosui.BorderThickness = new Thickness(0);
                }
            }
            catch (Exception)
            {

                return;
            }
        }

        private void zhizuo_MouseDown(object sender, MouseButtonEventArgs e)
        {

        }

        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            try
            {
                // EWMMsg.Instance.MsgShow("u***2024040250491024#2");
                if (qiehuan.Tag.ToString() == "0")
                {
                    grid1.Visibility = Visibility.Collapsed;
                    grid2.Visibility = Visibility.Collapsed;
                    grid3.Visibility = Visibility.Visible;
                    qiehuan.Visibility = Visibility.Collapsed;
                    Password.Password = "";
                    Password.Visibility = Visibility.Visible;
                    Password2.Visibility = Visibility.Collapsed;
                    vis.Tag = "0";
                    vis.Source = new BitmapImage(new Uri(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"不看.png"));
                }
                else
                {
                    grid1.Visibility = Visibility.Collapsed;
                    grid2.Visibility = Visibility.Visible;
                    grid3.Visibility = Visibility.Collapsed;
                    qiehuan.Tag = "0";
                    qiehuan.Visibility = Visibility.Visible;
                }
            }
            catch (Exception)
            {
                return;
            }
        }

        private void vis_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (vis.Tag.ToString() == "0")
                {
                    Password2.Text = Password.Password;
                    Password2.Focus();
                    Password.Visibility = Visibility.Collapsed;
                    Password2.Visibility = Visibility.Visible;
                    vis.Tag = "1";
                    vis.Source = new BitmapImage(new Uri(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"开启.png"));
                }
                else
                {
                    Password.Password = Password2.Text;
                    Password.Visibility = Visibility.Visible;
                    Password2.Visibility = Visibility.Collapsed;
                    vis.Tag = "0";
                    vis.Source = new BitmapImage(new Uri(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"不看.png"));
                }
            }
            catch (Exception)
            {
                return;
            }
        }

        private void Button_Click_5(object sender, RoutedEventArgs e)
        {
            try
            {
                string pass = vis.Tag.ToString() == "0" ? Password.Password : Password2.Text;
                if (pass == "motontech")
                {
                    grid1.Visibility = Visibility.Visible;
                    grid2.Visibility = Visibility.Collapsed;
                    grid3.Visibility = Visibility.Collapsed;
                    qiehuan.Visibility = Visibility.Visible;
                    qiehuan.Tag = "1";
                }
                else
                {
                    MessageBox.Show("密码错误");
                }
            }
            catch (Exception)
            {
                return;
            }
        }

        private void Button_Click_6(object sender, RoutedEventArgs e)
        {
            try
            {
                grid1.Visibility = Visibility.Collapsed;
                grid2.Visibility = Visibility.Visible;
                grid3.Visibility = Visibility.Collapsed;
                qiehuan.Visibility = Visibility.Visible;
            }
            catch (Exception)
            {
                return;
            }
        }

        private void Border_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 02 00 00 00 08 00 0F 00 01 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void Border_MouseDown_1(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 02 00 00 00 08 00 0F 00 02 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void Border_MouseDown_2(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 02 00 00 00 08 00 0F 00 03 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void Border_MouseDown_3(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 02 00 00 00 08 00 10 00 01 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void Border_MouseDown_4(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 02 00 00 00 08 00 10 00 02 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void Border_MouseDown_5(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 10 00 03 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void Border_MouseDown_6(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 11 00 01 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void Border_MouseDown_7(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 11 00 02 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void Border_MouseDown_8(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 11 00 03 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void boluo1_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 0F 00 01 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void boluo2_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 0F 00 02 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void boluo3_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 0F 00 03 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void caomei1_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 10 00 01 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void caomei2_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 10 00 02 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void caomei3_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 10 00 03 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void qkl1_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 11 00 01 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void qkl2_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 11 00 02 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void qkl3_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 11 00 03 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void qiaokeli1_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IceMsg.Instance.ClientSend("AA 00 20 00 00 00 08 00 11 00 01 00 00 00 00 00");
            }
            catch (Exception)
            {
                return;
            }
        }

        private void Image_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Window1 window1 = new Window1();
            window1.ShowDialog();
        }
    }
}
